package com.hehao.java_basic.proxy.cglib.dynamic;


import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @author Damon
 * @date 2022/10/26
 */
public class UsbSellInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object target, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        System.out.println("cglib动态代理类执行前获取的方法名："+method.getName());
        Object result = methodProxy.invokeSuper(target, args);
        System.out.println("cglib动态代理类执行后获取的方法名："+method.getName());
        return result;
    }
}
